home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10864 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.primenet.com!not-for-mail
  2. From: kj7bg@primenet.com (Bob White)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: question about string class
  5. Date: 11 Mar 1996 09:01:00 -0700
  6. Organization: Primenet Services for the Internet
  7. Sender: root@primenet.com
  8. Distribution: inet
  9. Message-ID: <4i1ins$6hm@nnrp1.news.primenet.com>
  10. References: <izrhgvwsov1.fsf@potkulauta.cs.hut.fi>
  11. X-Posted-By: ip161.boi.primenet.com
  12. X-Newsreader: WinVN 0.99.7
  13. MIME-Version: 1.0
  14. Content-Type: Text/Plain; charset=US-ASCII
  15.  
  16. I believe that you would use the following:
  17.  
  18. To empty a string, use the "resize" method.
  19.     string    text = "something";
  20.     text.resize( 0 );
  21.  
  22. To alter a specific character, use operator [].
  23.     string    text = "something";
  24.     text[8] = '!';
  25.  
  26. Hope that helps.
  27.             Bob
  28.  
  29. In article <izrhgvwsov1.fsf@potkulauta.cs.hut.fi>, hazor@potkulauta.cs.hut.fi 
  30. says...
  31. >
  32. >Where can I find information about the methods inside the string class
  33. >that comes with c++ (g++, #include <string>) ...?
  34. >
  35. >I need to know how can I empty my string, like if I have
  36. >string text;
  37. >text = "something";
  38. >text.empty();
  39. >
  40. >--> I want text to be empty but empty() method does not seem to work?
  41. >what is the right one?
  42. >
  43. >and then I want to know how to put a specific char into specifix place
  44. >in my string...
  45. >for example , I want to change the "something" into "somethin!"
  46. >what method does that?
  47. >
  48. >please, give me few examples about doing these...
  49. >-- 
  50. >Tommi Lahtonen, tlahtone@snakemail.hut.fi, URL: http://www.hut.fi/~tlahtone
  51. >
  52. >There is no point in being grown up if you can't be childish sometimes. -Dr. 
  53. Who
  54.  
  55.